﻿using blackhouse.WebNemo.Business.Groups;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace blackhouse.WebNemo.Business {
    internal class GroupCopier {

        #region Fields

        private IGroup source;
        private IGroup destination;

        #endregion

        #region Constructors

        public GroupCopier(IGroup sourceGroup, IGroup destinationGroup) {
            this.source = sourceGroup;
            this.destination = destinationGroup;
        }

        #endregion

        #region Methods

        internal void Copy() {
            if (this.source.Columns.Count > 0) {
                foreach (GroupColumn column in this.source.Columns) {
                    this.destination.Columns.Add(column);
                }
            }
            this.destination.Identyficator = this.source.Identyficator;
            this.destination.Name = String.IsNullOrEmpty(this.source.Name) ? this.source.SystemName : this.source.Name;
            this.destination.EnableTranslate = this.source.EnableTranslate;
            this.destination.ReadOnly = this.source.ReadOnly;
        }

        #endregion

    }
}
